/**
 * @description: 判断是否为IPv6地址
 */
export const  isValidIPv6=(ip:string):boolean => {
    let ipPattern = /^([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})$|^::([0-9a-fA-F]{1,4}:){6}([0-9a-fA-F]{1,4})$|^([0-9a-fA-F]{1,4})::([0-9a-fA-F]{1,4}:){5}([0-9a-fA-F]{1,4})$|^([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})::([0-9a-fA-F]{1,4}:){4}([0-9a-fA-F]{1,4})$|^([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})::([0-9a-fA-F]{1,4}:){3}([0-9a-fA-F]{1,4})$|^([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})::([0-9a-fA-F]{1,4}:){2}([0-9a-fA-F]{1,4})$|^([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})::([0-9a-fA-F]{1,4})$|^([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})::$/;
    return ipPattern.test(ip);
}
/***
 * 检测是否为IPv4地址
 * @param ip 待检测的字符串
 * @returns 
 */
export const  isValidIPv4=(ip:string):boolean  =>{
    let ipPattern = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
    return ipPattern.test(ip);
}
/**
 * 检测是否包含空格 包含返回true
 * @param str 待检测的字符串
 * @returns 
 */
export const  containsSpace=(str:string):boolean  => {
    return /\s/.test(str);
}
  